package com.luoye.lj.platform.controller.log;


import com.luoye.lj.util.mvc.log.DescriptionGeneratorAdapter;

import java.util.Map;

/**
 * Created by wuhao on 2015/11/25.
 执行了操作【系统级别编辑用户】,参数是：{"unitInfoList[0].mark":[""],"passwd":[""],"restaurantName":[""],
 "repasswd":[""],"unitInfoList[0].utype":["3"],"grade":["0"],"_csrf":["ec2fc025-e7bc-4ea7-ade5-0b68b9847ff1"],"id":["7"],"rid":["1"],"username":["www"]}
 * username: 用户名
 * passwd: 密码
 * roleName:角色
 * gradeName:级别
 * 关联餐厅
 */
public class ManagerSaveUserGenerator extends DescriptionGeneratorAdapter {
    @Override
    public String generate(String name, Map parameterMap) {
        String str = "编辑了用户。";
        String username = ((String[]) parameterMap.get("username"))[0];
        String passwd = ((String[]) parameterMap.get("passwd"))[0];
        String roleName = null;
        if(parameterMap.get("ridListStr")!=null){
            roleName = ((String[]) parameterMap.get("ridListStr"))[0];
        }
        String restaurantName=null;
        if(parameterMap.get("unitList")!=null){
            restaurantName=((String[])parameterMap.get("unitList"))[0];
        }
        String realName=((String[])parameterMap.get("realName"))[0];
        String email=((String[])parameterMap.get("email"))[0];
        String mobilePhone=((String[])parameterMap.get("mobilePhone"))[0];
        String status=((String[])parameterMap.get("status"))[0];
        str += "用户名：【" + username + "】,";
        str += "密码 ：【" + passwd + "】,";
        str += "角色 ：【" + roleName + "】,";
        str += "关联餐厅 ：【" + restaurantName + "】,";
        str += "姓名：【"+realName+"】,";
        str += "邮箱 ：【" + email + "】,";
        str += "手机号 ：【" + mobilePhone + "】,";
        str += "状态 ：【" + status + "】";
        return str;
    }
}
